package com.mm.cloud.sys.vo;

import com.mm.cloud.common.core.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 资源基础信息
 * </p>
 *
 * @author mr
 * @since 2020-09-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(description = "资源基础信息")
public class PermissionVO extends BaseEntity implements Serializable, Comparable<PermissionVO> {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "路由名称")
    private String name;

    @Schema(description = "资源标题")
    private String title;

    @Schema(description = "资源类型 1-菜单 2-按钮")
    private Byte type;

    @Schema(description = "资源图标")
    private String icon;

    @Schema(description = "权限标识")
    private String permissionCode;

    @Schema(description = "顺序")
    private Integer sort;

    @Schema(description = "请求路径")
    private String path;

    @Schema(description = "组件")
    private String component;

    @Schema(description = "父级ID")
    private Long pid;

    @Schema(description = "父级资源标题")
    private String ptitle;

    @Schema(description = "平台类型 1-平台管理 2-商城管理")
    private Byte platformType;

    @Schema(description = "子集")
    private List<PermissionVO> children;

    @Override
    public int compareTo(PermissionVO o) {
        return this.sort.compareTo(o.getSort());
    }
}
